package com.jzy.bxb.core.db.redis;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

/**
 * Redis配置
 *
 * @author JiangZhiYong
 * @date 2017-04-14 QQ:359135103
 */
@Root
public class RedisConfig {

	// 端口
	@Element(required = true)
	protected int port = 8000;

	// 连接超时
	@Element(required = false)
	protected int timeOut = 10 * 1000;

	// ip地址
	@Element(required = false)
	protected String ip = "127.0.0.1";

	// 密码
	@Element(required = false)
	protected String password = "127.0.0.1";
	
	//可用连接实例的最大数目，默认值为8；
    //如果赋值为-1，则表示不限制；如果pool已经分配了maxActive个jedis实例，则此时pool的状态为exhausted(耗尽)。
	@Element(required=false)
	protected int maxTotal=200;
	
	//控制一个pool最多有多少个状态为idle(空闲的)的jedis实例，默认值也是8。
	@Element(required=false)
	protected int maxIdle=100;
	
	//等待可用连接的最大时间，单位毫秒，默认值为-1，表示永不超时。如果超过等待时间，则直接抛出JedisConnectionException；
	@Element(required=false)
	protected int maxWaitMillis=10000;
	
	//在borrow一个jedis实例时，是否提前进行validate操作；如果为true，则得到的jedis实例均是可用的；
	@Element(required=false)
	protected boolean testOnBorrow=true;

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public int getTimeOut() {
		return timeOut;
	}

	public void setTimeOut(int timeOut) {
		this.timeOut = timeOut;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getMaxTotal() {
		return maxTotal;
	}

	public void setMaxTotal(int maxTotal) {
		this.maxTotal = maxTotal;
	}

	public int getMaxIdle() {
		return maxIdle;
	}

	public void setMaxIdle(int maxIdle) {
		this.maxIdle = maxIdle;
	}

	public int getMaxWaitMillis() {
		return maxWaitMillis;
	}

	public void setMaxWaitMillis(int maxWaitMillis) {
		this.maxWaitMillis = maxWaitMillis;
	}

	public boolean isTestOnBorrow() {
		return testOnBorrow;
	}

	public void setTestOnBorrow(boolean testOnBorrow) {
		this.testOnBorrow = testOnBorrow;
	}

	
}
